import { createApp } from 'vue'
import { createRouter, createWebHashHistory } from 'vue-router'
import { setupLayouts } from 'virtual:generated-layouts'
import pages from 'virtual:generated-pages'
import App from './App.vue'
import './assets'
import { initAMapApiLoader } from '~/services/injected-amap-api-instance'
import { createPinia } from 'pinia'
import  utils  from '~/util/index.js'



const app = createApp(App)
app.config.warnHandler = () => null
app.use(
  createRouter({
    history: createWebHashHistory(),
    routes: setupLayouts(pages),
  })
)

// 配置高德数据
initAMapApiLoader({
  key: '167887b5a9ae24b2b91fd1d2b1308071',
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.MoveAnimation', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  // 默认高德 sdk 版本为 1.4.4
  version: '2.0'
})


app.config.globalProperties.$utils = utils
app.use(createPinia())

app.mount(`#app`)

